package santeclair.referentiel.optique.model;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import santeclair.lunar.framework.annotation.Code;
import santeclair.lunar.framework.annotation.HashCodeEquals;
import santeclair.lunar.framework.annotation.ToString;
import santeclair.lunar.framework.util.EqualsUtils;
import santeclair.lunar.framework.util.HashCodeUtils;
import santeclair.lunar.framework.util.ToStringUtils;
import santeclair.referentiel.optique.config.Constant;

@Entity
@Table(name = "tr_traitement_verre", catalog = Constant.SCHEMA_NAME, uniqueConstraints = @UniqueConstraint(columnNames = "code_traitement_verre"))
public class TraitementVerre implements java.io.Serializable {

    private static final long serialVersionUID = 8045613598435945137L;

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "identifiant_traitement_verre", unique = true, nullable = false)
    @HashCodeEquals
    @ToString
    private Integer identifiantTraitementVerre;

    @Code
    @Column(name = "code_traitement_verre", unique = true, nullable = false, length = 10)
    @HashCodeEquals
    @ToString
    private String codeTraitementVerre;

    @Column(name = "libelle_traitement_verre", nullable = false)
    @HashCodeEquals
    @ToString
    private String libelleTraitementVerre;

    @Column(name = "code_ffl_traitement_verre", nullable = true)
    @HashCodeEquals
    @ToString
    private String codefflTraitementVerre;

    @Column(name = "libelle_ffl_traitement_verre", nullable = true)
    @HashCodeEquals
    @ToString
    private String libellefflTraitementVerre;

    @ManyToOne(fetch = FetchType.LAZY, targetEntity = TypeTraitementVerre.class)
    @JoinColumn(name = "identifiant_type_traitement_verre")
    private TypeTraitementVerre typeTraitementVerre;

    public TraitementVerre() {
    }

    public Integer getIdentifiant() {
        return this.identifiantTraitementVerre;
    }

    public void setIdentifiant(Integer identifiantTraitementVerre) {
        this.identifiantTraitementVerre = identifiantTraitementVerre;
    }

    public String getCode() {
        return this.codeTraitementVerre;
    }

    public void setCode(String codeTraitementVerre) {
        this.codeTraitementVerre = codeTraitementVerre;
    }

    public String getLibelle() {
        return this.libelleTraitementVerre;
    }

    public void setLibelle(String libelleTraitementVerre) {
        this.libelleTraitementVerre = libelleTraitementVerre;
    }

    public String getCodefflTraitementVerre() {
        return this.codefflTraitementVerre;
    }

    public void setCodefflTraitementVerre(String codefflTraitementVerre) {
        this.codefflTraitementVerre = codefflTraitementVerre;
    }

    public String getLibellefflTraitementVerre() {
        return libellefflTraitementVerre;
    }

    public void setLibellefflTraitementVerre(String libellefflTraitementVerre) {
        this.libellefflTraitementVerre = libellefflTraitementVerre;
    }

    public Integer getIdentifiantTraitementVerre() {
        return identifiantTraitementVerre;
    }

    public void setIdentifiantTraitementVerre(Integer identifiantTraitementVerre) {
        this.identifiantTraitementVerre = identifiantTraitementVerre;
    }

    public String getCodeTraitementVerre() {
        return codeTraitementVerre;
    }

    public void setCodeTraitementVerre(String codeTraitementVerre) {
        this.codeTraitementVerre = codeTraitementVerre;
    }

    public String getLibelleTraitementVerre() {
        return libelleTraitementVerre;
    }

    public void setLibelleTraitementVerre(String libelleTraitementVerre) {
        this.libelleTraitementVerre = libelleTraitementVerre;
    }

    public TypeTraitementVerre getTypeTraitementVerre() {
        return typeTraitementVerre;
    }

    public void setTypeTraitementVerre(TypeTraitementVerre typeTraitementVerre) {
        this.typeTraitementVerre = typeTraitementVerre;
    }

    @Override
    public String toString() {
        return ToStringUtils.toString(this);
    }

    @Override
    public int hashCode() {
        return HashCodeUtils.hashCode(this);
    }

    @Override
    public boolean equals(Object obj) {
        return EqualsUtils.isEqual(this, obj);
    }

}
